<template>
    <div class="ann-page">
        <div class="top">
            <jLink :list="breadcrumbs" @hit="backTo"></jLink>
        </div>
        <div class="hts">{{ info.title }}</div>
        <div class="d-time">{{ info.time }}</div>
        <div class="details" v-html="info.desc"></div>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, toRefs, computed, onMounted } from "vue"
import i18n from "@/locals";
import bigDealTable from './components/bigDeal-table.vue';
import jLink from "@/components/j-link/index.vue";
import rightRank from './components/right-rank.vue';
import JPage from "@/components/j-page/index.vue";
import { useRoute, useRouter } from "vue-router";
import { URL_PRESS_NEWS } from "@/comm/api";
import { get } from "@/comm/request";
import { formatTimeAgo, formatTimestamp } from "@/comm/format";
const router = useRouter()
const route = useRoute();
const breadcrumbs = reactive([{
    title: i18n.global.t("message.News.info.b"),
    disabled: true,
    href: '/',
}, {
    title: i18n.global.t("message.other2.ann"),
    disabled: true,
    href: '/ann',
}]);

const info = reactive({
    title: "",
    time: "",
    desc: ""
})

const backTo = (e: any) => {
    console.log(e);
    router.push(e.href)
}

onMounted(async () => {
    console.log(route, "route")
    let res: any = await get(URL_PRESS_NEWS + "/" + route.params.id);
    info.time = formatTimestamp(Number(`${res.data.date}000`));
    info.title = res.data.title;
    info.desc = res.data.content;
    breadcrumbs.push({
        title: info.title,
        disabled: false,
        href: ""
    })
})
</script>

<style lang="less" scoped>
@import url("./index.less");
</style>